From bef5a7699a6b0c665bddadf91691a46e7d39b8d5 Mon Sep 17 00:00:00 2001 From: "kfraser@localhost.localdomain" Date: Wed, 2 Aug 2006 09:15:26 +0100 Subject: [PATCH] [PCI] back: Fix potential infinite loop in pcistub_match_one(). The for loop in pcistub_match_one will loop forever if the dev->bus->self links to itself at the uppermost bridge. Adding a check to prevent linking back in on itself prevents this. Signed-off-by: Jon Mason --- linux-2.6-xen-sparse/drivers/xen/pciback/pci_stub.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/linux-2.6-xen-sparse/drivers/xen/pciback/pci_stub.c b/linux-2.6-xen-sparse/drivers/xen/pciback/pci_stub.c index aab9238c2d..b33855932d 100644 --- a/linux-2.6-xen-sparse/drivers/xen/pciback/pci_stub.c +++ b/linux-2.6-xen-sparse/drivers/xen/pciback/pci_stub.c @@ -232,6 +232,10 @@ static int __devinit pcistub_match_one(struct pci_dev *dev, && dev->bus->number == pdev_id->bus && dev->devfn == pdev_id->devfn) return 1; + + /* Sometimes topmost bridge links to itself. */ + if (dev == dev->bus->self) + break; } return 0; -- 2.30.2